﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LevelSelector.aspx.cs"
    Inherits="LearnJquery.LevelSelector" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="js/jquery-1.4.1-vsdoc.js"></script>
</head>
<body>
    <form id="form1" runat="server">
    <label>
        Name:</label>
    <input name="name" />
    <fieldset>
        <label>
            Newsletter:</label>
        <input name="newsletter" />
    </fieldset>
    <div>
        <input type="button" value="AllOffspring" onclick="allOffspring()" />
        <input type="button" value="AllChild" onclick="allChild()" />
        <input type="button" value="NextNode" onclick="nextNode()" />
        <input type="button" value="SiblingNodes" onclick="siblingNodes()" />
    </div>
    </form>
    <input name="none" />
</body>
</html>
<script type="text/javascript">
    function allOffspring() {
        var p = $("form input");
        alert(p.length);
    }

    function allChild() {
        var p = $("form > input");
        alert(p.length);
    }

    function nextNode() {
        var p = $("label+input");
        alert(p.length);
    }

    function siblingNodes() {
        var p = $("form~input");
        alert(p.length);
    }
</script>
